from PyQt5.QtWidgets import QApplication
from src.ui.main_window import MainWindow
import sys
import logging

logging.basicConfig(level=logging.INFO,
                   format='%(asctime)s - %(levelname)s - %(message)s')

def main():
    try:
        app = QApplication(sys.argv)
        app.setStyle('Fusion')
        app.setApplicationName("PDF编辑器")
        app.setOrganizationName("CodeLeaner")
        
        window = MainWindow()
        window.show()
        
        sys.exit(app.exec_())
    except Exception as e:
        logging.error(f"应用启动错误: {str(e)}")
        sys.exit(1)

if __name__ == '__main__':
    main()
